const changeTime = function (ts) {
  const now = parseInt(new Date().getTime() / 1000)
  const dist = now - ts
  if (dist <= 60) { return '1分钟前' }
  else if (dist > 60 && dist <= 120) { return '2分钟前' }
  else if (dist > 120 && dist <= 300) { return '5分钟前' }
  else if (dist > 300 && dist <= 1800) { return '30分钟前' }
  else if (dist > 1800 && dist <= 3600) { return '1小时前' }
  else if (dist > 3600 && dist <= 7200) { return '2小时前' }
  else if (dist > 7200 && dist <= 21600) { return '6小时前' }
  else if (dist > 21600 && dist <= 43200) { return '12小时前' }
  else if (dist > 43200 && dist <= 86400) { return '1天前' }
  if (dist > 86400) { return `${parseInt(dist / 86400)}天前` }
}
export default changeTime
